/**
 * 
 */
function loadChart() {
	var flow = [];
	for (var i = 0; i < 40; i++) {
		flow.push(Math.floor(Math.random() * (10 + ((i % 16) * 5))) + 10);
	}
	var data = [ {
		name : 'PV',
		value : dataflow,
		color : '#ec4646',
		line_width : 2
	} ];
	var labels = [ "00", "01", "02", "03", "04", "05", "06", "07", "08", "09",
			"10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20",
			"21", "22", "23" ];
	var chart = new iChart.LineBasic2D(
			{
				render : 'canvasDiv',
				data : data,
				align : 'center',
				footnote : {
					text : 'xm-lab',
					font : '微软雅黑',
					fontsize : 11,
					fontweight : 600,
					padding : '0 28',
					color : '#b4b4b4'
				},
				width : 800,
				height : 400,
				shadow : true,
				shadow_color : '#202020',
				shadow_blur : 8,
				shadow_offsetx : 0,
				shadow_offsety : 0,
				background_color : '#2e2e2e',
				tip : {
					enable : true,
					shadow : true,
					listeners : {
						// tip:提示框对象、name:数据名称、value:数据值、text:当前文本、i:数据点的索引
						parseText : function(tip, name, value, text, i) {
							return "<span style='color:#005268;font-size:12px;'>"
									+ timeflow[i]
									+ "测量值:<br/>"
									+ "</span><span style='color:#005268;font-size:20px;'>"
									+ value + "mV</span>";
						}
					}
				},
				crosshair : {
					enable : true,
					line_color : '#ec4646'
				},
				sub_option : {
					smooth : true,
					label : false,
					hollow : false,
					hollow_inside : false,
					point_size : 8
				},
				coordinate : {
					width : 640,
					height : 260,
					striped_factor : 0.18,
					grid_color : '#4e4e4e',
					axis : {
						color : '#252525',
						width : [ 0, 0, 4, 4 ]
					},
					scale : [ {
						position : 'left',
						start_scale : 0,
						end_scale : 5000,
						scale_space : 500,
						scale_size : 2,
						scale_enable : false,
						label : {
							color : '#9d987a',
							font : '微软雅黑',
							fontsize : 11,
							fontweight : 600
						},
						scale_color : '#9f9f9f'
					}, {
						position : 'bottom',
						label : {
							color : '#9d987a',
							font : '微软雅黑',
							fontsize : 11,
							fontweight : 600
						},
						scale_enable : false,
						labels : labflow
					} ]
				}
			});
			//利用自定义组件构造左侧说明文本
			chart.plugin(new iChart.Custom({
				drawFn:function(){
				//计算位置
					var coo = chart.getCoordinate(),
					x = coo.get('originx'),
					y = coo.get('originy'),
					w = 640,
					h = 260;
					//在左上侧的位置，渲染一个单位的文字
					chart.target.textAlign('start')
					.textBaseline('bottom')
					.textFont('600 11px 微软雅黑')
					.fillText('(电压[mV])',x-50,y-12,false,'#9d987a')
					.textBaseline('top')
					.fillText('(时间)',x+w+12,y+h+10,false,'#9d987a');
				}
			})); 
	// 开始画图
	chart.draw();
}